<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" th:href="@{/css/common.css}">
    <link rel="stylesheet" th:href="@{/css/main.css}">
    <script language="JavaScript">
        function delTopic(topicId){
            if(window.confirm("是否确认删除日志？")){
                window.location.href="topic.do?operate=delTopic&topicId="+topicId;
            }
        }
    </script>
</head>
<body>
<div id="div_topic_list">
    <div id="div_to_add">
        <p class="right8">发表新日志</p>
    </div>
    <table id="tbl_topic_list">
        <tr>
            <th>ID</th>
            <th>标题</th>
            <th>日期</th>
            <th>操作</th>
        </tr>
        <tr th:if="${#lists.isEmpty(session.friend.topicList)}">
            <th colspan="4">暂无日志列表</th>
        </tr>
        <tr th:unless="${#lists.isEmpty(session.friend.topicList)}" th:each="topic : ${session.friend.topicList}">
            <td th:text="${topic.id}">2</td>
            <td class="left">
                <a th:href="@{|/topic.do?operate=topicDetail&id=${topic.id}|}" th:text="${topic.title}">我乔峰要走，你们谁可阻拦</a>
            </td>
            <td th:text="${#dates.format(topic.topicDate,'yyyy-MM-dd HH:mm:ss')}">2021-09-01 12:30:55</td>
            <td><input type="button" value="删除" th:if="${session.userBasic.id==session.friend.id}" th:onclick="|delTopic(${topic.id})|"/></td>
        </tr>
    </table>
</div>
</body>
</html>